//*****************************************************************************
//
// Copyright, (C) 2000-2005 Quantic Dream SA
//
// These coded instructions, statements and computer programs contain
// unpublished information, proprietary to Quantic Dream SA and are 
// protected by French and EEC copyright laws. They may not be 
// disclosed to third parties or copied or duplicated, in whole or in part, 
// without prior written consent of Quantic Dream SA
//
// Unpublished-rights reserved under the Copyright Laws of the EEC.
//
//*****************************************************************************
//
//	CLASS:	CAMERA
//	The CAMERA class implements ...
//
//	JJA : 2012-07-23 - Created
//*****************************************************************************

//=============================================================================
//	CODE STARTS HERE
//=============================================================================

#ifndef CAMERA_H
#define CAMERA_H

#include <gl/glew.h>
#include <Kernel/KernelDefines.h>

#include "Transform/Transform.h"

class	DECLARE_ALIGNED( 16 ) CAMERA: public TRANSFORM
{
public:
				CAMERA();
				~CAMERA();

	void		Translate( const VECTOR3& vTranslate );
	void		RotateHead( const float fAngleInRadians );
	void		RotatePitch( const float fAngleInRadians );

	// Inline accessors
	inline void	SetFieldOfView( const float fFieldOfView )
	{
		_fFieldOfView = fFieldOfView;
		UpdateProjectionMatrix();
	}

	inline void	SetAspectRatio( const float fAspectRatio )
	{
		_fAspectRatio = fAspectRatio;
		UpdateProjectionMatrix();
	}

	inline void	SetNearClippingDistance( const float fNearClippingDistance )
	{
		_fNearClippingDistance = fNearClippingDistance;
		UpdateProjectionMatrix();
	}

	inline void	SetFarClippingDistance( const float fFarClippingDistance )
	{
		_fFarClippingDistance = fFarClippingDistance;
		UpdateProjectionMatrix();
	}

	inline const MATRIX4& GetProjectionMatrix() const
	{
		return	( _mProjectionMatrix );
	}

				ALIGNED_NEW_DELETE( 16 )

private:
	inline void	UpdateProjectionMatrix()
	{
		_mProjectionMatrix = MATRIX4::perspective( DEGREES_TO_RADIANS( _fFieldOfView ), _fAspectRatio, _fNearClippingDistance, _fFarClippingDistance );
	}

	POINT3		_vCameraPosition;
	VECTOR3		_vCameraAt;
	VECTOR3		_vCameraUp;

	float		_fFieldOfView;
	float		_fAspectRatio;
	float		_fNearClippingDistance;
	float		_fFarClippingDistance;

	//MATRIX4		_mViewMatrix;
	MATRIX4		_mProjectionMatrix;
};

#endif // CAMERA_H

//=============================================================================
//	CODE ENDS HERE
//=============================================================================
